package com.zdd.ehe.config;

import com.zdd.ehe.interceptor.JwtValidateInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 暂时注释
 * @title:JwtInterceptorConfig
 * @author:ZhuiZhu
 * @description:Jwt配置类
 * @createDate: 2023/3/12  20:08
 */
//@Configuration
public class JwtInterceptorConfig implements WebMvcConfigurer {
    @Autowired
    private JwtValidateInterceptor jwtValidateInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(jwtValidateInterceptor);
        registration.addPathPatterns("/**") //拦截所有路径
                .excludePathPatterns("/account/login",
                        "/account/logout",
                        "/error",
                        "/swagger-ui/**",
                        "/swagger-resources/**"); // 除/user/login、/user/logout、/error以及swagger外
    }
}
